<!DOCTYPE html>
<html><head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    
    <link rel="canonical" href="/android/db/">

    <title>
        
        DB | h-book
        
    </title>

    
    <link href="/css/fontawesome.min.css" rel="stylesheet">

    
    <link rel="stylesheet" href="/css/ace.min.css">

    

    

</head>
<body><nav class="navbar navbar-expand-lg navbar-dark bg-primary shadow sticky-top" id="navbarMain">
    <div class="container">
        <div>
            <a class="navbar-brand" href="/">
                
                h-book
            </a>
        </div>
    </div>
</nav>
<div class="container-fluid">
            <div class="row">

                <div class="docs-sidenav order-0 col-12 col-md-3 col-lg-2 col-xl-2 position-sticky border-right"><nav class="navbar navbar-expand-md navbar-light pl-0">
    <button class="navbar-toggler navbar-toggler-right collapsed" type="button" data-toggle="collapse" data-target="#sidenav-left-collapse" aria-controls="sidenav-left-collapse" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

     <div class="collapse navbar-collapse align-items-start flex-column" id="sidenav-left-collapse">
            <form class="form-inline my-2 my-lg-0 searchbox">
                <input class="form-control mr-sm-2 w-100" data-search-input id="search-by" type="text" placeholder="Search">
            </form>

        

         <ul class="navbar-nav flex-column pt-3">
    <li data-nav-id="/hugo/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/hugo/"><h6>Hugo</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/hugo/init/" class="nav-item my-1">
                
                
                  <a href="/hugo/init/" class="nav-link p-0">
                    init
                  </a>
                
        </li>
        <li data-nav-id="/hugo/add-page/" class="nav-item my-1">
                
                
                  <a href="/hugo/add-page/" class="nav-link p-0">
                    add-page
                  </a>
                
        </li>
        <li data-nav-id="/hugo/edit-skill/" class="nav-item my-1">
                
                
                  <a href="/hugo/edit-skill/" class="nav-link p-0">
                    edit-skill
                  </a>
                
        </li>
        <li data-nav-id="/hugo/publish/" class="nav-item my-1">
                
                
                  <a href="/hugo/publish/" class="nav-link p-0">
                    publish
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/android/" class="nav-item my-1 parent haschildren
        ">
        
        
          <a class="nav-link p-0" href="/android/"><h6>Android</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/android/install/" class="nav-item my-1">
                
                
                  <a href="/android/install/" class="nav-link p-0">
                    install
                  </a>
                
        </li>
        <li data-nav-id="/android/create-project/" class="nav-item my-1">
                
                
                  <a href="/android/create-project/" class="nav-link p-0">
                    create project
                  </a>
                
        </li>
        <li data-nav-id="/android/import-material/" class="nav-item my-1">
                
                
                  <a href="/android/import-material/" class="nav-link p-0">
                    import material
                  </a>
                
        </li>
        <li data-nav-id="/android/start-page/" class="nav-item my-1">
                
                
                  <a href="/android/start-page/" class="nav-link p-0">
                    startpage
                  </a>
                
        </li>
        <li data-nav-id="/android/i18n/" class="nav-item my-1">
                
                
                  <a href="/android/i18n/" class="nav-link p-0">
                    i18n
                  </a>
                
        </li>
        <li data-nav-id="/android/nav-flat-page/" class="nav-item my-1">
                
                
                  <a href="/android/nav-flat-page/" class="nav-link p-0">
                    nav flat page
                  </a>
                
        </li>
        <li data-nav-id="/android/activity/" class="nav-item my-1">
                
                
                  <a href="/android/activity/" class="nav-link p-0">
                    Activity
                  </a>
                
        </li>
        <li data-nav-id="/android/db/" class="nav-item my-1 active">
                
                
                  <a href="/android/db/" class="nav-link p-0">
                    DB
                  </a>
                
        </li>
        <li data-nav-id="/android/dialog/" class="nav-item my-1">
                
                
                  <a href="/android/dialog/" class="nav-link p-0">
                    Dialog
                  </a>
                
        </li>
        <li data-nav-id="/android/fragment/" class="nav-item my-1">
                
                
                  <a href="/android/fragment/" class="nav-link p-0">
                    Fragment
                  </a>
                
        </li>
        <li data-nav-id="/android/jetpack/" class="nav-item my-1">
                
                
                  <a href="/android/jetpack/" class="nav-link p-0">
                    Jetpack
                  </a>
                
        </li>
        <li data-nav-id="/android/material/" class="nav-item my-1">
                
                
                  <a href="/android/material/" class="nav-link p-0">
                    Material
                  </a>
                
        </li>
        <li data-nav-id="/android/storage/" class="nav-item my-1">
                
                
                  <a href="/android/storage/" class="nav-link p-0">
                    Storage
                  </a>
                
        </li>
        <li data-nav-id="/android/%E5%9B%BE%E6%A0%87/" class="nav-item my-1">
                
                
                  <a href="/android/%E5%9B%BE%E6%A0%87/" class="nav-link p-0">
                    图标
                  </a>
                
        </li>
        <li data-nav-id="/android/store/" class="nav-item my-1">
                
                
                  <a href="/android/store/" class="nav-link p-0">
                    Store
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/blender/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/blender/"><h6>Blender</h6></a>
        
    </li>
    <li data-nav-id="/bootstrap/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/bootstrap/"><h6>BootStrap</h6></a>
        
    </li>
    <li data-nav-id="/centos7/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/centos7/"><h6>Centos7</h6></a>
        
    </li>
    <li data-nav-id="/dlna/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/dlna/"><h6>DLNA</h6></a>
        
    </li>
    <li data-nav-id="/docker/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/docker/"><h6>Docker</h6></a>
        
    </li>
    <li data-nav-id="/dubbo/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/dubbo/"><h6>Dubbo</h6></a>
        
    </li>
    <li data-nav-id="/ffmpeg/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/ffmpeg/"><h6>FFmpeg</h6></a>
        
    </li>
    <li data-nav-id="/git/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/git/"><h6>Git</h6></a>
        
    </li>
    <li data-nav-id="/gitbook/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/gitbook/"><h6>Gitbook</h6></a>
        
    </li>
    <li data-nav-id="/gitlab/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/gitlab/"><h6>Gitlab</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/gitlab/runner/" class="nav-item my-1">
                
                
                  <a href="/gitlab/runner/" class="nav-link p-0">
                    Runner
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/gradle/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/gradle/"><h6>Gradle</h6></a>
        
    </li>
    <li data-nav-id="/java/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/java/"><h6>Java</h6></a>
        
    </li>
    <li data-nav-id="/jenkins/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/jenkins/"><h6>Jenkins</h6></a>
        
    </li>
    <li data-nav-id="/kubernetes/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/kubernetes/"><h6>Kubernetes</h6></a>
        
    </li>
    <li data-nav-id="/mybatis/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/mybatis/"><h6>Mybatis</h6></a>
        
    </li>
    <li data-nav-id="/mybatis-plus/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/mybatis-plus/"><h6>Mybatis Plus</h6></a>
        
    </li>
    <li data-nav-id="/mysql/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/mysql/"><h6>MySQL</h6></a>
        
    </li>
    <li data-nav-id="/nodejs/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/nodejs/"><h6>Node.js</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/nodejs/npm/" class="nav-item my-1">
                
                
                  <a href="/nodejs/npm/" class="nav-link p-0">
                    NPM
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/postgresql/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/postgresql/"><h6>PostgreSQL</h6></a>
        
    </li>
    <li data-nav-id="/redis/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/redis/"><h6>Redis</h6></a>
        
    </li>
    <li data-nav-id="/samba/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/samba/"><h6>Samba</h6></a>
        
    </li>
    <li data-nav-id="/sql/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/sql/"><h6>SQL</h6></a>
        
    </li>
    <li data-nav-id="/ue5/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/ue5/"><h6>UE5</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/ue5/install/" class="nav-item my-1">
                
                
                  <a href="/ue5/install/" class="nav-link p-0">
                    install
                  </a>
                
        </li>
        <li data-nav-id="/ue5/uninstall/" class="nav-item my-1">
                
                
                  <a href="/ue5/uninstall/" class="nav-link p-0">
                    uninstall
                  </a>
                
        </li>
        <li data-nav-id="/ue5/qa/" class="nav-item my-1">
                
                
                  <a href="/ue5/qa/" class="nav-link p-0">
                    Q&amp;A
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity/"><h6>Unity</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity/install/" class="nav-item my-1">
                
                
                  <a href="/unity/install/" class="nav-link p-0">
                    install
                  </a>
                
        </li>
        <li data-nav-id="/unity/scene/" class="nav-item my-1">
                
                
                  <a href="/unity/scene/" class="nav-link p-0">
                    scene
                  </a>
                
        </li>
        <li data-nav-id="/unity/inspector/" class="nav-item my-1">
                
                
                  <a href="/unity/inspector/" class="nav-link p-0">
                    inspector
                  </a>
                
        </li>
        <li data-nav-id="/unity/assets/" class="nav-item my-1">
                
                
                  <a href="/unity/assets/" class="nav-link p-0">
                    assets
                  </a>
                
        </li>
        <li data-nav-id="/unity/audio-source/" class="nav-item my-1">
                
                
                  <a href="/unity/audio-source/" class="nav-link p-0">
                    audio source
                  </a>
                
        </li>
        <li data-nav-id="/unity/camera/" class="nav-item my-1">
                
                
                  <a href="/unity/camera/" class="nav-link p-0">
                    camera
                  </a>
                
        </li>
        <li data-nav-id="/unity/script/" class="nav-item my-1">
                
                
                  <a href="/unity/script/" class="nav-link p-0">
                    script
                  </a>
                
        </li>
        <li data-nav-id="/unity/prefabs/" class="nav-item my-1">
                
                
                  <a href="/unity/prefabs/" class="nav-link p-0">
                    prefabs
                  </a>
                
        </li>
        <li data-nav-id="/unity/physics/" class="nav-item my-1">
                
                
                  <a href="/unity/physics/" class="nav-link p-0">
                    physics
                  </a>
                
        </li>
        <li data-nav-id="/unity/skybox/" class="nav-item my-1">
                
                
                  <a href="/unity/skybox/" class="nav-link p-0">
                    skybox
                  </a>
                
        </li>
        <li data-nav-id="/unity/particle-system/" class="nav-item my-1">
                
                
                  <a href="/unity/particle-system/" class="nav-link p-0">
                    particle system
                  </a>
                
        </li>
        <li data-nav-id="/unity/shortcut-keys/" class="nav-item my-1">
                
                
                  <a href="/unity/shortcut-keys/" class="nav-link p-0">
                    shortcut keys
                  </a>
                
        </li>
        <li data-nav-id="/unity/qa/" class="nav-item my-1">
                
                
                  <a href="/unity/qa/" class="nav-link p-0">
                    Q&amp;A
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-2d-beginner/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-2d-beginner/"><h6>Unity 2D Beginner</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-2d-beginner/init-and-move/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/init-and-move/" class="nav-link p-0">
                    Init &amp; Move
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/map/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/map/" class="nav-link p-0">
                    Map
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/data/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/data/" class="nav-link p-0">
                    Data
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/animate/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/animate/" class="nav-link p-0">
                    Data
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/bullet/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/bullet/" class="nav-link p-0">
                    Bullet
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/cinemachine/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/cinemachine/" class="nav-link p-0">
                    Cinemachine
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/particle/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/particle/" class="nav-link p-0">
                    Particle
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/ui/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/ui/" class="nav-link p-0">
                    UI
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/npc/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/npc/" class="nav-link p-0">
                    NPC
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/sound/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/sound/" class="nav-link p-0">
                    Sound
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-2d-game-kit/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-2d-game-kit/"><h6>Unity 2D Game Kit</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-2d-game-kit/record/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-game-kit/record/" class="nav-link p-0">
                    record
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-3d-beginner/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-3d-beginner/"><h6>Unity 3D Beginner</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-3d-beginner/init/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/init/" class="nav-link p-0">
                    Init
                  </a>
                
        </li>
        <li data-nav-id="/unity-3d-beginner/level/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/level/" class="nav-link p-0">
                    Level
                  </a>
                
        </li>
        <li data-nav-id="/unity-3d-beginner/nav/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/nav/" class="nav-link p-0">
                    Nav
                  </a>
                
        </li>
        <li data-nav-id="/unity-3d-beginner/render-pipeline/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/render-pipeline/" class="nav-link p-0">
                    Render Pipeline
                  </a>
                
        </li>
        <li data-nav-id="/unity-3d-beginner/postprocessing/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/postprocessing/" class="nav-link p-0">
                    PostProcessing
                  </a>
                
        </li>
        <li data-nav-id="/unity-3d-beginner/ui/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/ui/" class="nav-link p-0">
                    UI
                  </a>
                
        </li>
        <li data-nav-id="/unity-3d-beginner/enemy/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/enemy/" class="nav-link p-0">
                    Enemy
                  </a>
                
        </li>
        <li data-nav-id="/unity-3d-beginner/sound/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/sound/" class="nav-link p-0">
                    Sound
                  </a>
                
        </li>
        <li data-nav-id="/unity-3d-beginner/%E5%BB%BA%E6%A8%A1%E5%B7%A5%E5%85%B7/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/%E5%BB%BA%E6%A8%A1%E5%B7%A5%E5%85%B7/" class="nav-link p-0">
                    建模工具
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-arpg/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-arpg/"><h6>Unity ARPG</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-arpg/init/" class="nav-item my-1">
                
                
                  <a href="/unity-arpg/init/" class="nav-link p-0">
                    Init
                  </a>
                
        </li>
        <li data-nav-id="/unity-arpg/role-state-machine/" class="nav-item my-1">
                
                
                  <a href="/unity-arpg/role-state-machine/" class="nav-link p-0">
                    Role State Machine
                  </a>
                
        </li>
        <li data-nav-id="/unity-arpg/api-piece/" class="nav-item my-1">
                
                
                  <a href="/unity-arpg/api-piece/" class="nav-link p-0">
                    API Piece
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-creativecore-animation/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-creativecore-animation/"><h6>Unity Creativecore Animation</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-creativecore-animation/door/" class="nav-item my-1">
                
                
                  <a href="/unity-creativecore-animation/door/" class="nav-link p-0">
                    Door
                  </a>
                
        </li>
        <li data-nav-id="/unity-creativecore-animation/init/" class="nav-item my-1">
                
                
                  <a href="/unity-creativecore-animation/init/" class="nav-link p-0">
                    Init
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-creativecore-lighting/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-creativecore-lighting/"><h6>Unity Creativecore Lighting</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-creativecore-lighting/init/" class="nav-item my-1">
                
                
                  <a href="/unity-creativecore-lighting/init/" class="nav-link p-0">
                    Init
                  </a>
                
        </li>
        <li data-nav-id="/unity-creativecore-lighting/outdoor/" class="nav-item my-1">
                
                
                  <a href="/unity-creativecore-lighting/outdoor/" class="nav-link p-0">
                    Outdoor
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-creativecore-shader/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-creativecore-shader/"><h6>Unity Creativecore Shader</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-creativecore-shader/init/" class="nav-item my-1">
                
                
                  <a href="/unity-creativecore-shader/init/" class="nav-link p-0">
                    Init
                  </a>
                
        </li>
        <li data-nav-id="/unity-creativecore-shader/glass/" class="nav-item my-1">
                
                
                  <a href="/unity-creativecore-shader/glass/" class="nav-link p-0">
                    Glass
                  </a>
                
        </li>
        <li data-nav-id="/unity-creativecore-shader/shader-graph/" class="nav-item my-1">
                
                
                  <a href="/unity-creativecore-shader/shader-graph/" class="nav-link p-0">
                    Shader-Graph
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-creator-kit-beginner-code/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-creator-kit-beginner-code/"><h6>Unity Creator Kit Beginner Code</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-creator-kit-beginner-code/record/" class="nav-item my-1">
                
                
                  <a href="/unity-creator-kit-beginner-code/record/" class="nav-link p-0">
                    record
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-creator-kit-fps/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-creator-kit-fps/"><h6>Unity Creator Kit FPS</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-creator-kit-fps/record/" class="nav-item my-1">
                
                
                  <a href="/unity-creator-kit-fps/record/" class="nav-link p-0">
                    record
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-mythirdperson/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-mythirdperson/"><h6>Unity My Third Person</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-mythirdperson/init/" class="nav-item my-1">
                
                
                  <a href="/unity-mythirdperson/init/" class="nav-link p-0">
                    Init
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-playground/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-playground/"><h6>Unity Playground</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-playground/record/" class="nav-item my-1">
                
                
                  <a href="/unity-playground/record/" class="nav-link p-0">
                    record
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-ui/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-ui/"><h6>Unity UI</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-ui/init/" class="nav-item my-1">
                
                
                  <a href="/unity-ui/init/" class="nav-link p-0">
                    record
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-vfx/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-vfx/"><h6>Unity VFX</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-vfx/init/" class="nav-item my-1">
                
                
                  <a href="/unity-vfx/init/" class="nav-link p-0">
                    record
                  </a>
                
        </li>
        <li data-nav-id="/unity-vfx/bullet/" class="nav-item my-1">
                
                
                  <a href="/unity-vfx/bullet/" class="nav-link p-0">
                    bullet
                  </a>
                
        </li>
        <li data-nav-id="/unity-vfx/rain/" class="nav-item my-1">
                
                
                  <a href="/unity-vfx/rain/" class="nav-link p-0">
                    rain
                  </a>
                
        </li>
        <li data-nav-id="/unity-vfx/rock-rain/" class="nav-item my-1">
                
                
                  <a href="/unity-vfx/rock-rain/" class="nav-link p-0">
                    Rock Rain
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/vue/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/vue/"><h6>Vue</h6></a>
        
    </li>
    <li data-nav-id="/web/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/web/"><h6>Web</h6></a>
        
    </li>
        </ul>
    </div>
</nav>


</div>
                <div class="docs-toc large order-lg-2 order-md-0 order-xs-1 col-12 col-lg-2 col-xl-2 position-sticky border-left"><div class="docs-toc">
	<nav id="TableOfContents">
  <ul>
    <li><a href="#room">Room</a>
      <ul>
        <li><a href="#可用依赖">可用依赖</a></li>
        <li><a href="#工程a使用">工程A使用</a></li>
      </ul>
    </li>
  </ul>
</nav>
</div>
</div>
                <div class="main col-12 order-1 col-md-9 col-lg-10 col-xl-8 py-3">
                

<div class="d-flex flex-column">
    <h1 class="js-title">DB</h1>
    <div class="d-flex align-items-center">
        
    </div>
</div>

<hr>


<p>有 Room 持久性库和 SQLite API ，两者相比，前者</p>
<ul>
<li>提供针对 SQL 查询的编译时验证。</li>
<li>提供方便注解，可最大限度减少重复和容易出错的样板代码。</li>
<li>简化了数据库迁移路径。</li>
</ul>
<p>后者</p>
<ul>
<li>没有针对原始 SQL 查询的编译时验证。随着数据图表不断发生变化，您需要手动更新受影响的 SQL 查询。此过程既耗时又容易出错。</li>
<li>您需要使用大量样板代码，在 SQL 查询和数据对象之间进行转换。</li>
</ul>
<p>摘自 <a href="https://developer.android.google.cn/training/data-storage/room">https://developer.android.google.cn/training/data-storage/room</a> 和 <a href="https://developer.android.google.cn/training/data-storage/sqlite">https://developer.android.google.cn/training/data-storage/sqlite</a></p>
<h2 id="room">Room</h2>
<h3 id="可用依赖">可用依赖</h3>
<p>2024-04-23年从上述官网中得知，依赖库包括如下</p>
<div class="highlight"><pre tabindex="0" style="color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-groovy" data-lang="groovy"><span style="display:flex;"><span><span style="color:#111">dependencies</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>    <span style="color:#00a8c8">def</span> <span style="color:#111">room_version</span> <span style="color:#f92672">=</span> <span style="color:#d88200">&#34;2.6.1&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">implementation</span> <span style="color:#d88200">&#34;androidx.room:room-runtime:$room_version&#34;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">annotationProcessor</span> <span style="color:#d88200">&#34;androidx.room:room-compiler:$room_version&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#75715e">// To use Kotlin annotation processing tool (kapt) 
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#75715e">// 使用 KAPT 处理 Room 注解所需的依赖项。
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">kapt</span> <span style="color:#d88200">&#34;androidx.room:room-compiler:$room_version&#34;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#75715e">// To use Kotlin Symbol Processing (KSP) 
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#75715e">// 使用 KSP 处理 Room 注解所需的依赖项。
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#75715e">// 与 kapt 二选一即可，有问题再尝试选用另一个
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">ksp</span> <span style="color:#d88200">&#34;androidx.room:room-compiler:$room_version&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#75715e">// optional - RxJava2 support for Room
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#75715e">// 可选，用处尚未得知
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">implementation</span> <span style="color:#d88200">&#34;androidx.room:room-rxjava2:$room_version&#34;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#75715e">// optional - RxJava3 support for Room
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#75715e">// 可选，用处尚未得知
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">implementation</span> <span style="color:#d88200">&#34;androidx.room:room-rxjava3:$room_version&#34;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#75715e">// optional - Guava support for Room, including Optional and ListenableFuture
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#75715e">// 可选，用处尚未得知，但这三个应该也是同一类作用，择一即可
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">implementation</span> <span style="color:#d88200">&#34;androidx.room:room-guava:$room_version&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#75715e">// optional - Test helpers
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#75715e">// 可选
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">testImplementation</span> <span style="color:#d88200">&#34;androidx.room:room-testing:$room_version&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#75715e">// optional - Paging 3 Integration
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#75715e">// 可选，用处尚未得知，猜测是分页有关
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">implementation</span> <span style="color:#d88200">&#34;androidx.room:room-paging:$room_version&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span></code></pre></div><p>均在app目录中的build.gradle中添加。其中 2.6.1 要根据实际情况改写，其所有版本在 <a href="https://developer.android.google.cn/jetpack/androidx/releases/room">https://developer.android.google.cn/jetpack/androidx/releases/room</a> 可查。另外 KAPT 和 KSP 区别摘自 chatgpt</p>
<ol>
<li>KAPT（Kotlin Annotation Processing Tool）：</li>
</ol>
<ul>
<li>使用场景：在较早的 Kotlin 项目中，通常会使用 KAPT 来处理注解。KAPT 是 Kotlin 的官方注解处理器，它允许你使用类似于 Java 中的注解处理器的方式来处理 Kotlin 代码中的注解。</li>
<li>特点：KAPT 将 Kotlin 代码转换为 Java 代码，然后将注解处理器应用于生成的 Java 代码。因此，它能够与大多数现有的 Java 注解处理器兼容。</li>
</ul>
<ol start="2">
<li>KSP（Kotlin Symbol Processing）：</li>
</ol>
<ul>
<li>使用场景：KSP 是 Kotlin 1.5 引入的新特性，旨在提供更高效、更灵活的 Kotlin 注解处理解决方案。它是一个直接处理 Kotlin 符号的工具，而不需要将 Kotlin 代码转换为 Java。</li>
<li>特点：KSP 直接访问 Kotlin 代码的符号信息，因此可以更高效地处理 Kotlin 注解。与 KAPT 相比，KSP 更快，而且在某些情况下提供了更好的性能和灵活性。</li>
</ul>
<p>然后是 Room Gradle 插件。虽然推荐使用，但按照官网下载插件失败，提示需要 jdk17 ，目前开发环境用的 jdk 11 ，所以尚未使用</p>
<h3 id="工程a使用">工程A使用</h3>
<p>参考</p>
<ul>
<li><a href="https://developer.android.google.cn/build/dependencies">https://developer.android.google.cn/build/dependencies</a></li>
<li><a href="https://developer.android.google.cn/build/migrate-to-ksp">https://developer.android.google.cn/build/migrate-to-ksp</a></li>
<li><a href="https://developer.android.google.cn/codelabs/android-room-with-a-view-kotlin">https://developer.android.google.cn/codelabs/android-room-with-a-view-kotlin</a></li>
<li><a href="https://developer.android.google.cn/training/data-storage/room/migrating-db-versions">https://developer.android.google.cn/training/data-storage/room/migrating-db-versions</a></li>
</ul>
<p>顶级目录的build.gradle写的是</p>
<div class="highlight"><pre tabindex="0" style="color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-groovy" data-lang="groovy"><span style="display:flex;"><span><span style="color:#111">plugins</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">id</span> <span style="color:#d88200">&#39;com.android.application&#39;</span> <span style="color:#111">version</span> <span style="color:#d88200">&#39;7.2.1&#39;</span> <span style="color:#111">apply</span> <span style="color:#00a8c8">false</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">id</span> <span style="color:#d88200">&#39;com.android.library&#39;</span> <span style="color:#111">version</span> <span style="color:#d88200">&#39;7.2.1&#39;</span> <span style="color:#111">apply</span> <span style="color:#00a8c8">false</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">id</span> <span style="color:#d88200">&#39;org.jetbrains.kotlin.android&#39;</span> <span style="color:#111">version</span> <span style="color:#d88200">&#39;1.6.10&#39;</span> <span style="color:#111">apply</span> <span style="color:#00a8c8">false</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">id</span> <span style="color:#d88200">&#39;org.jetbrains.kotlin.kapt&#39;</span> <span style="color:#111">version</span> <span style="color:#d88200">&#39;1.6.10&#39;</span> <span style="color:#111">apply</span> <span style="color:#00a8c8">false</span> <span style="color:#75715e">// 添加，版本去中央仓库查
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">id</span> <span style="color:#d88200">&#39;com.google.devtools.ksp&#39;</span> <span style="color:#111">version</span> <span style="color:#d88200">&#39;1.6.10-1.0.4&#39;</span> <span style="color:#111">apply</span> <span style="color:#00a8c8">false</span> <span style="color:#75715e">// 与上面二选一，前面是kotlin版本后面是ksp版本
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#111">task</span> <span style="color:#75af00">clean</span><span style="color:#f92672">(</span><span style="color:#111">type:</span> <span style="color:#111">Delete</span><span style="color:#f92672">)</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">delete</span> <span style="color:#111">rootProject</span><span style="color:#f92672">.</span><span style="color:#75af00">buildDir</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span></code></pre></div><p>app目录的build.gradle写的是</p>
<div class="highlight"><pre tabindex="0" style="color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-groovy" data-lang="groovy"><span style="display:flex;"><span><span style="color:#111">plugins</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">id</span> <span style="color:#d88200">&#39;com.android.application&#39;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">id</span> <span style="color:#d88200">&#39;org.jetbrains.kotlin.android&#39;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">id</span> <span style="color:#d88200">&#39;org.jetbrains.kotlin.kapt&#39;</span> <span style="color:#75715e">// 添加
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">id</span> <span style="color:#d88200">&#39;com.google.devtools.ksp&#39;</span> <span style="color:#75715e">// 与上面二选一
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#111">android</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">compileSdk</span> <span style="color:#ae81ff">32</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">defaultConfig</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>        <span style="color:#111">applicationId</span> <span style="color:#d88200">&#34;com.hcindy.myapp&#34;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#111">minSdk</span> <span style="color:#ae81ff">16</span>
</span></span><span style="display:flex;"><span>        <span style="color:#111">targetSdk</span> <span style="color:#ae81ff">32</span>
</span></span><span style="display:flex;"><span>        <span style="color:#111">versionCode</span> <span style="color:#ae81ff">1</span>
</span></span><span style="display:flex;"><span>        <span style="color:#111">versionName</span> <span style="color:#d88200">&#34;1.0&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>        <span style="color:#111">testInstrumentationRunner</span> <span style="color:#d88200">&#34;androidx.test.runner.AndroidJUnitRunner&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>        <span style="color:#111">javaCompileOptions</span> <span style="color:#f92672">{</span> <span style="color:#75715e">// 添加
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>            <span style="color:#111">annotationProcessorOptions</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>                <span style="color:#111">arguments</span> <span style="color:#f92672">+=</span> <span style="color:#f92672">[</span> <span style="color:#75715e">// 写法一
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                        <span style="color:#d88200">&#34;room.schemaLocation&#34;</span><span style="color:#f92672">:</span> <span style="color:#d88200">&#34;$projectDir/schemas&#34;</span><span style="color:#f92672">.</span><span style="color:#75af00">toString</span><span style="color:#f92672">()</span>
</span></span><span style="display:flex;"><span>                <span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>                <span style="color:#75715e">// compilerArgumentProviders( // 写法二
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                <span style="color:#75715e">//         new RoomSchemaArgProvider(new File(projectDir, &#34;schemas&#34;))
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                <span style="color:#75715e">// )
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>            <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">buildTypes</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>        <span style="color:#111">release</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>            <span style="color:#111">minifyEnabled</span> <span style="color:#00a8c8">false</span>
</span></span><span style="display:flex;"><span>            <span style="color:#111">proguardFiles</span> <span style="color:#75af00">getDefaultProguardFile</span><span style="color:#f92672">(</span><span style="color:#d88200">&#39;proguard-android-optimize.txt&#39;</span><span style="color:#f92672">),</span> <span style="color:#d88200">&#39;proguard-rules.pro&#39;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">compileOptions</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>        <span style="color:#111">sourceCompatibility</span> <span style="color:#111">JavaVersion</span><span style="color:#f92672">.</span><span style="color:#75af00">VERSION_1_8</span>
</span></span><span style="display:flex;"><span>        <span style="color:#111">targetCompatibility</span> <span style="color:#111">JavaVersion</span><span style="color:#f92672">.</span><span style="color:#75af00">VERSION_1_8</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">kotlinOptions</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>        <span style="color:#111">jvmTarget</span> <span style="color:#f92672">=</span> <span style="color:#d88200">&#39;1.8&#39;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#111">ksp</span> <span style="color:#f92672">{</span> <span style="color:#75715e">// 与 android javaCompileOptions annotationProcessorOptions 二选一
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">arg</span><span style="color:#f92672">(</span><span style="color:#d88200">&#34;room.schemaLocation&#34;</span><span style="color:#f92672">,</span> <span style="color:#d88200">&#34;$projectDir/schemas&#34;</span><span style="color:#f92672">.</span><span style="color:#75af00">toString</span><span style="color:#f92672">())</span> <span style="color:#75715e">// 写法一
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#75715e">// arg(new RoomSchemaArgProvider(new File(projectDir, &#34;schemas&#34;))) // 写法二
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">class</span> <span style="color:#75af00">RoomSchemaArgProvider</span> <span style="color:#00a8c8">implements</span> <span style="color:#111">CommandLineArgumentProvider</span> <span style="color:#f92672">{</span> <span style="color:#75715e">// 支撑上面的写法二
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">@InputDirectory</span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">@PathSensitive</span><span style="color:#f92672">(</span><span style="color:#111">PathSensitivity</span><span style="color:#f92672">.</span><span style="color:#75af00">RELATIVE</span><span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">File</span> <span style="color:#111">schemaDir</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">RoomSchemaArgProvider</span><span style="color:#f92672">(</span><span style="color:#111">File</span> <span style="color:#111">schemaDir</span><span style="color:#f92672">)</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>        <span style="color:#00a8c8">this</span><span style="color:#f92672">.</span><span style="color:#75af00">schemaDir</span> <span style="color:#f92672">=</span> <span style="color:#111">schemaDir</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">@Override</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">Iterable</span><span style="color:#f92672">&lt;</span><span style="color:#111">String</span><span style="color:#f92672">&gt;</span> <span style="color:#111">asArguments</span><span style="color:#f92672">()</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>        <span style="color:#75715e">// KAPT
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>        <span style="color:#00a8c8">return</span> <span style="color:#f92672">[</span><span style="color:#d88200">&#34;-Aroom.schemaLocation=${schemaDir.path}&#34;</span><span style="color:#f92672">.</span><span style="color:#75af00">toString</span><span style="color:#f92672">()]</span>
</span></span><span style="display:flex;"><span>        <span style="color:#75715e">// KSP 二选一
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>        <span style="color:#00a8c8">return</span> <span style="color:#f92672">[</span><span style="color:#d88200">&#34;room.schemaLocation=${schemaDir.path}&#34;</span><span style="color:#f92672">.</span><span style="color:#75af00">toString</span><span style="color:#f92672">()]</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#111">dependencies</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">implementation</span> <span style="color:#d88200">&#39;androidx.core:core-ktx:1.7.0&#39;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">implementation</span> <span style="color:#d88200">&#39;androidx.appcompat:appcompat:1.4.2&#39;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">implementation</span> <span style="color:#d88200">&#39;com.google.android.material:material:1.6.1&#39;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">implementation</span> <span style="color:#d88200">&#39;androidx.constraintlayout:constraintlayout:2.1.4&#39;</span>
</span></span><span style="display:flex;"><span>    
</span></span><span style="display:flex;"><span>    <span style="color:#00a8c8">def</span> <span style="color:#111">room_version</span> <span style="color:#f92672">=</span> <span style="color:#d88200">&#34;2.4.3&#34;</span> <span style="color:#75715e">// 添加，2.4的最后个版本，用2.5就会和kotlin 1.6版本不兼容（依赖构建不全，写代码IDE无法导包）
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">implementation</span> <span style="color:#d88200">&#34;androidx.room:room-runtime:$room_version&#34;</span> <span style="color:#75715e">// 添加
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">annotationProcessor</span> <span style="color:#d88200">&#34;androidx.room:room-compiler:$room_version&#34;</span> <span style="color:#75715e">// 添加
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">kapt</span> <span style="color:#d88200">&#34;androidx.room:room-compiler:$room_version&#34;</span> <span style="color:#75715e">// 添加
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">ksp</span> <span style="color:#d88200">&#34;androidx.room:room-compiler:$room_version&#34;</span> <span style="color:#75715e">// 与上面二选一
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#f92672">}</span>
</span></span></code></pre></div><p>虽然有写 ksp ，但实际依赖构建不全，写代码IDE无法导包，所以以上的 ksp 相关仅作记录，可能更新版本的环境能支持。另外关于 <code>javaCompileOptions</code> 部分，是对参考中的 <code>如果您使用的是 Room 2.5.2 或更低版本，或者未使用 Room Gradle 插件，请使用 room.schemaLocation 注解处理器选项设置架构位置。</code> 体现：首先这里用的是 2.4.3 满足前半句，然后用不了 Room Gradle 插件（最低 2.6.0 ，没有 2.4.3 对应的插件），满足后半句，所以只能自己配置（<code>javaCompileOptions</code> 部分），作用是支撑编译环节，否则编译不过，而且还要手动事先在 app 下创建 schemas 目录。至于可配置的内容， <code>room.schemaLocation</code> 必选项：支持将数据库架构导出到给定目录中的 JSON 文件；<code>room.incremental</code> 可选项：启用 Gradle 增量注解处理器。默认值为 true；<code>room.generateKotlin</code> 可选项：生成 Kotlin 源文件，而非 Java 代码。需要 KSP。默认值为 false。</p>
<p>定义entity</p>
<div class="highlight"><pre tabindex="0" style="color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-kotlin" data-lang="kotlin"><span style="display:flex;"><span><span style="color:#00a8c8">import</span> <span style="color:#111">androidx.room.ColumnInfo</span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">import</span> <span style="color:#111">androidx.room.Entity</span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">import</span> <span style="color:#111">androidx.room.PrimaryKey</span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">import</span> <span style="color:#111">androidx.room.TypeConverters</span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">import</span> <span style="color:#111">java.util.*</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75af00">@Entity</span><span style="color:#111">(</span><span style="color:#111">tableName</span> <span style="color:#111">=</span> <span style="color:#d88200">&#34;term_table&#34;</span><span style="color:#111">)</span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">data</span> <span style="color:#00a8c8">class</span> <span style="color:#75af00">Term</span><span style="color:#111">(</span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">@PrimaryKey</span><span style="color:#111">(</span><span style="color:#111">autoGenerate</span> <span style="color:#111">=</span> <span style="color:#00a8c8">true</span><span style="color:#111">)</span> <span style="color:#00a8c8">val</span> <span style="color:#111">id</span><span style="color:#111">:</span> <span style="color:#111">Int</span><span style="color:#111">?,</span> <span style="color:#75715e">// 创建 Term 时，id 传 null 才会自增
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#75af00">@ColumnInfo</span><span style="color:#111">(</span><span style="color:#111">name</span> <span style="color:#111">=</span> <span style="color:#d88200">&#34;first_term&#34;</span><span style="color:#111">)</span> <span style="color:#00a8c8">val</span> <span style="color:#111">firstTerm</span><span style="color:#111">:</span> <span style="color:#111">String</span><span style="color:#111">?,</span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">@ColumnInfo</span><span style="color:#111">(</span><span style="color:#111">name</span> <span style="color:#111">=</span> <span style="color:#d88200">&#34;second_term&#34;</span><span style="color:#111">)</span> <span style="color:#00a8c8">val</span> <span style="color:#111">secondTerm</span><span style="color:#111">:</span> <span style="color:#111">String</span><span style="color:#111">?,</span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">@ColumnInfo</span><span style="color:#111">(</span><span style="color:#111">name</span> <span style="color:#111">=</span> <span style="color:#d88200">&#34;third_term&#34;</span><span style="color:#111">)</span> <span style="color:#00a8c8">val</span> <span style="color:#111">thirdTerm</span><span style="color:#111">:</span> <span style="color:#111">String</span><span style="color:#111">?,</span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">@ColumnInfo</span><span style="color:#111">(</span><span style="color:#111">name</span> <span style="color:#111">=</span> <span style="color:#d88200">&#34;create_time&#34;</span><span style="color:#111">)</span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">@field</span><span style="color:#111">:</span><span style="color:#111">TypeConverters</span><span style="color:#111">(</span><span style="color:#111">DateConverter</span><span style="color:#f92672">::</span><span style="color:#00a8c8">class</span><span style="color:#111">)</span> <span style="color:#75715e">// field 是指加在属性上，而不是构造方法的入参也不是 get 方法。主要是因为 kotlin 的语法，这里即代表属性，又代表构造方法的入参，也代表 get 方法，所以需要明确指代，否则编译不过
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#00a8c8">val</span> <span style="color:#111">createTime</span><span style="color:#111">:</span> <span style="color:#111">Date</span><span style="color:#111">?,</span>
</span></span><span style="display:flex;"><span><span style="color:#111">)</span>
</span></span></code></pre></div><p>定义类型转换器。因为底层的 sqlite 不支持所有的类型， room 也无法自动转换，所以需要编码自定义的类型转换器。使用就按上面的方式，另外该 @TypeConverters 可以用在 @Entity 或 @Database 上，更多详见源码注释</p>
<div class="highlight"><pre tabindex="0" style="color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-kotlin" data-lang="kotlin"><span style="display:flex;"><span><span style="color:#00a8c8">import</span> <span style="color:#111">androidx.room.TypeConverter</span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">import</span> <span style="color:#111">java.util.*</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">class</span> <span style="color:#75af00">DateConverter</span> <span style="color:#111">{</span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">@TypeConverter</span>
</span></span><span style="display:flex;"><span>    <span style="color:#00a8c8">fun</span> <span style="color:#75af00">timestampToDate</span><span style="color:#111">(</span><span style="color:#00a8c8">value</span><span style="color:#111">:</span> <span style="color:#111">Long</span><span style="color:#111">?):</span> <span style="color:#111">Date</span><span style="color:#111">?</span> <span style="color:#111">{</span>
</span></span><span style="display:flex;"><span>        <span style="color:#00a8c8">return</span> <span style="color:#00a8c8">value</span><span style="color:#f92672">?.</span><span style="color:#111">let</span> <span style="color:#111">{</span> <span style="color:#111">Date</span><span style="color:#111">(</span><span style="color:#00a8c8">it</span><span style="color:#111">)</span> <span style="color:#111">}</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">@TypeConverter</span>
</span></span><span style="display:flex;"><span>    <span style="color:#00a8c8">fun</span> <span style="color:#75af00">dateToTimestamp</span><span style="color:#111">(</span><span style="color:#111">date</span><span style="color:#111">:</span> <span style="color:#111">Date</span><span style="color:#111">?):</span> <span style="color:#111">Long</span><span style="color:#111">?</span> <span style="color:#111">{</span>
</span></span><span style="display:flex;"><span>        <span style="color:#00a8c8">return</span> <span style="color:#111">date</span><span style="color:#f92672">?.</span><span style="color:#111">time</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">}</span>
</span></span><span style="display:flex;"><span><span style="color:#111">}</span>
</span></span></code></pre></div><p>定义dao</p>
<div class="highlight"><pre tabindex="0" style="color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-kotlin" data-lang="kotlin"><span style="display:flex;"><span><span style="color:#00a8c8">import</span> <span style="color:#111">androidx.room.*</span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">import</span> <span style="color:#111">com.hcindy.myapp.entity.Term</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75af00">@Dao</span>
</span></span><span style="display:flex;"><span><span style="color:#75af00">@SuppressWarnings</span><span style="color:#111">(</span><span style="color:#75af00">RoomWarnings</span><span style="color:#111">.</span><span style="color:#111">CURSOR_MISMATCH</span><span style="color:#111">)</span> <span style="color:#75715e">// 比如 getFirstTerms 和 getSecondTerms 返回的不是一个完整的 Term ，所以编译时候会有错误，但不影响运行，
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#00a8c8">interface</span> <span style="color:#75af00">TermDao</span> <span style="color:#111">{</span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">@Query</span><span style="color:#111">(</span><span style="color:#d88200">&#34;SELECT first_term, create_time FROM term_table&#34;</span><span style="color:#111">)</span>
</span></span><span style="display:flex;"><span>    <span style="color:#00a8c8">fun</span> <span style="color:#75af00">getFirstTerms</span><span style="color:#111">():</span> <span style="color:#111">List</span><span style="color:#111">&lt;</span><span style="color:#111">Term</span><span style="color:#111">&gt;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">@Query</span><span style="color:#111">(</span><span style="color:#d88200">&#34;SELECT second_term, create_time FROM term_table WHERE first_term = :firstTerm&#34;</span><span style="color:#111">)</span>
</span></span><span style="display:flex;"><span>    <span style="color:#00a8c8">fun</span> <span style="color:#75af00">getSecondTerms</span><span style="color:#111">(</span><span style="color:#111">firstTerm</span><span style="color:#111">:</span> <span style="color:#111">String</span><span style="color:#111">):</span> <span style="color:#111">List</span><span style="color:#111">&lt;</span><span style="color:#111">Term</span><span style="color:#111">&gt;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">@Insert</span>
</span></span><span style="display:flex;"><span>    <span style="color:#00a8c8">fun</span> <span style="color:#75af00">insertTerm</span><span style="color:#111">(</span><span style="color:#111">term</span><span style="color:#111">:</span> <span style="color:#111">Term</span><span style="color:#111">):</span> <span style="color:#111">Long</span> <span style="color:#75715e">// 不能写 Int
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#75af00">@Delete</span>
</span></span><span style="display:flex;"><span>    <span style="color:#00a8c8">fun</span> <span style="color:#75af00">delete</span><span style="color:#111">(</span><span style="color:#111">term</span><span style="color:#111">:</span> <span style="color:#111">Term</span><span style="color:#111">)</span>
</span></span><span style="display:flex;"><span><span style="color:#111">}</span>
</span></span></code></pre></div><p>定义Database</p>
<div class="highlight"><pre tabindex="0" style="color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-kotlin" data-lang="kotlin"><span style="display:flex;"><span><span style="color:#00a8c8">import</span> <span style="color:#111">android.content.Context</span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">import</span> <span style="color:#111">androidx.room.Database</span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">import</span> <span style="color:#111">androidx.room.Room</span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">import</span> <span style="color:#111">androidx.room.RoomDatabase</span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">import</span> <span style="color:#111">com.hcindy.myapp.entity.Term</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75af00">@Database</span><span style="color:#111">(</span><span style="color:#111">entities</span> <span style="color:#111">=</span> <span style="color:#111">[</span><span style="color:#111">Term</span><span style="color:#f92672">::</span><span style="color:#00a8c8">class</span><span style="color:#111">],</span> <span style="color:#111">version</span> <span style="color:#111">=</span> <span style="color:#ae81ff">1</span><span style="color:#111">)</span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">abstract</span> <span style="color:#00a8c8">class</span> <span style="color:#75af00">AppDatabase</span> <span style="color:#111">:</span> <span style="color:#111">RoomDatabase</span><span style="color:#111">()</span> <span style="color:#111">{</span>
</span></span><span style="display:flex;"><span>    <span style="color:#00a8c8">abstract</span> <span style="color:#00a8c8">fun</span> <span style="color:#75af00">termDao</span><span style="color:#111">():</span> <span style="color:#111">TermDao</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#00a8c8">companion</span> <span style="color:#00a8c8">object</span> <span style="color:#111">{</span>
</span></span><span style="display:flex;"><span>        <span style="color:#75715e">// Singleton prevents multiple instances of database opening at the same time.
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>        <span style="color:#75af00">@Volatile</span>
</span></span><span style="display:flex;"><span>        <span style="color:#00a8c8">private</span> <span style="color:#00a8c8">var</span> <span style="color:#111">INSTANCE</span><span style="color:#111">:</span> <span style="color:#111">AppDatabase</span><span style="color:#111">?</span> <span style="color:#111">=</span> <span style="color:#00a8c8">null</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>        <span style="color:#00a8c8">fun</span> <span style="color:#75af00">getDatabase</span><span style="color:#111">(</span><span style="color:#111">context</span><span style="color:#111">:</span> <span style="color:#111">Context</span><span style="color:#111">):</span> <span style="color:#111">AppDatabase</span> <span style="color:#111">{</span>
</span></span><span style="display:flex;"><span>            <span style="color:#75715e">// if the INSTANCE is not null, then return it,
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>            <span style="color:#75715e">// if it is, then create the database
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>            <span style="color:#00a8c8">return</span> <span style="color:#111">INSTANCE</span> <span style="color:#f92672">?:</span> <span style="color:#111">synchronized</span><span style="color:#111">(</span><span style="color:#00a8c8">this</span><span style="color:#111">)</span> <span style="color:#111">{</span>
</span></span><span style="display:flex;"><span>                <span style="color:#00a8c8">val</span> <span style="color:#111">instance</span> <span style="color:#111">=</span> <span style="color:#75af00">Room</span><span style="color:#111">.</span><span style="color:#111">databaseBuilder</span><span style="color:#111">(</span>
</span></span><span style="display:flex;"><span>                    <span style="color:#111">context</span><span style="color:#111">.</span><span style="color:#111">applicationContext</span><span style="color:#111">,</span>
</span></span><span style="display:flex;"><span>                    <span style="color:#111">AppDatabase</span><span style="color:#f92672">::</span><span style="color:#00a8c8">class</span><span style="color:#111">.</span><span style="color:#111">java</span><span style="color:#111">,</span>
</span></span><span style="display:flex;"><span>                    <span style="color:#d88200">&#34;database-app&#34;</span>
</span></span><span style="display:flex;"><span>                <span style="color:#111">).</span><span style="color:#111">build</span><span style="color:#111">()</span>
</span></span><span style="display:flex;"><span>                <span style="color:#111">INSTANCE</span> <span style="color:#111">=</span> <span style="color:#111">instance</span>
</span></span><span style="display:flex;"><span>                <span style="color:#75715e">// return instance
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                <span style="color:#111">instance</span>
</span></span><span style="display:flex;"><span>            <span style="color:#111">}</span>
</span></span><span style="display:flex;"><span>        <span style="color:#111">}</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">}</span>
</span></span><span style="display:flex;"><span><span style="color:#111">}</span>
</span></span></code></pre></div><p>使用Database</p>
<div class="highlight"><pre tabindex="0" style="color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-kotlin" data-lang="kotlin"><span style="display:flex;"><span><span style="color:#00a8c8">private</span> <span style="color:#00a8c8">lateinit</span> <span style="color:#00a8c8">var</span> <span style="color:#111">db</span><span style="color:#111">:</span> <span style="color:#111">TermDao</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">override</span> <span style="color:#00a8c8">fun</span> <span style="color:#75af00">onCreate</span><span style="color:#111">(</span><span style="color:#111">savedInstanceState</span><span style="color:#111">:</span> <span style="color:#111">Bundle</span><span style="color:#111">?)</span> <span style="color:#111">{</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">db</span> <span style="color:#111">=</span> <span style="color:#75af00">Room</span><span style="color:#111">.</span><span style="color:#111">databaseBuilder</span><span style="color:#111">(</span>
</span></span><span style="display:flex;"><span>        <span style="color:#111">applicationContext</span><span style="color:#111">,</span>
</span></span><span style="display:flex;"><span>        <span style="color:#111">AppDatabase</span><span style="color:#f92672">::</span><span style="color:#00a8c8">class</span><span style="color:#111">.</span><span style="color:#111">java</span><span style="color:#111">,</span>
</span></span><span style="display:flex;"><span>        <span style="color:#d88200">&#34;database-app&#34;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">)</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">.</span><span style="color:#111">addMigrations</span><span style="color:#111">()</span> <span style="color:#75715e">// 允许迁移数据库，当数据库变更时，默认会删数据，用此设置保留数据（详细特性还是要参看官网）
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">.</span><span style="color:#111">allowMainThreadQueries</span><span style="color:#111">()</span> <span style="color:#75715e">// 在ui线程中默认是不允许拿数据库的，若只是作流程验证，可以用此方法临时调试
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">.</span><span style="color:#111">build</span><span style="color:#111">()</span> <span style="color:#75715e">// 获取 AppDatabase 对象
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#111">.</span><span style="color:#111">termDao</span><span style="color:#111">()</span> <span style="color:#75715e">// 本 Activity 只需要 TermDao ，所以只拿TermDao 。如果需要多个dao或其它逻辑，比如权限、网络，官网示例代码会进一步封装 repostiory
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>
</span></span><span style="display:flex;"><span>    <span style="color:#00a8c8">val</span> <span style="color:#111">res</span> <span style="color:#111">=</span> <span style="color:#111">db</span><span style="color:#111">.</span><span style="color:#111">insertTerms</span><span style="color:#111">(</span><span style="color:#111">Term</span><span style="color:#111">(</span><span style="color:#00a8c8">null</span><span style="color:#111">,</span> <span style="color:#d88200">&#34;abc&#34;</span><span style="color:#111">,</span> <span style="color:#d88200">&#34;qwe&#34;</span><span style="color:#111">,</span> <span style="color:#d88200">&#34;22d3&#34;</span><span style="color:#111">,</span> <span style="color:#111">Date</span><span style="color:#111">()))</span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">Log</span><span style="color:#111">.</span><span style="color:#111">i</span><span style="color:#111">(</span><span style="color:#d88200">&#34;insert to db get res&#34;</span><span style="color:#111">,</span> <span style="color:#111">res</span><span style="color:#111">.</span><span style="color:#111">toString</span><span style="color:#111">())</span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">Log</span><span style="color:#111">.</span><span style="color:#111">i</span><span style="color:#111">(</span><span style="color:#d88200">&#34;get first terms&#34;</span><span style="color:#111">,</span> <span style="color:#111">db</span><span style="color:#111">.</span><span style="color:#111">getFirstTerms</span><span style="color:#111">().</span><span style="color:#111">toString</span><span style="color:#111">())</span>
</span></span><span style="display:flex;"><span>    <span style="color:#75af00">Log</span><span style="color:#111">.</span><span style="color:#111">i</span><span style="color:#111">(</span><span style="color:#d88200">&#34;get second terms&#34;</span><span style="color:#111">,</span> <span style="color:#111">db</span><span style="color:#111">.</span><span style="color:#111">getSecondTerms</span><span style="color:#111">(</span><span style="color:#d88200">&#34;abc&#34;</span><span style="color:#111">).</span><span style="color:#111">toString</span><span style="color:#111">())</span>
</span></span><span style="display:flex;"><span><span style="color:#111">}</span>
</span></span></code></pre></div>

    


                    
                    <div class="row"></div> 

                </div>

            </div> 

        </div> 
<script src="/lib/jquery.min.js"></script> 
<script src="/lib/popper.min.js"></script> 

<script src="/js/bootstrap.min.js"></script> 


<script type="text/javascript" src="/plugins/lunr.min.js"></script>
<script type="text/javascript" src="/plugins/auto-complete.js"></script>
<link href="/plugins/auto-complete.css" rel="stylesheet">
<script type="text/javascript">
  
      var baseurl = "\/";
  
</script>
<script type="text/javascript" src="/plugins/search.js"></script>

<script type="text/javascript" src="/plugins/favorites.js"></script>


<script type="text/javascript" src="/plugins/clipboard.js"></script>
<script>
  new ClipboardJS('.btn');
</script>
</body>
</html>
